﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Should;

namespace NGeo.Yahoo.PlaceFinder
{
    [TestClass]
    public class QualityExtensionsTests
    {
        [TestMethod]
        public void Yahoo_PlaceFinder_ResultsQualityCategory_ShouldBeArea_WhenQualityIsLessThan70()
        {
            var model = new Results
            {
                Quality = 69,
            };

            model.QualityCategory().ShouldEqual(QualityCategory.Area);
        }

        [TestMethod]
        public void Yahoo_PlaceFinder_ResultsQualityCategory_ShouldBeLine_WhenQualityIsGreaterThan69AndLessThan80()
        {
            var model = new Results
            {
                Quality = 79,
            };

            model.QualityCategory().ShouldEqual(QualityCategory.Line);
        }

        [TestMethod]
        public void Yahoo_PlaceFinder_ResultsQualityCategory_ShouldBePoint_WhenQualityIsGreaterThan79()
        {
            var model = new Results
            {
                Quality = 80,
            };

            model.QualityCategory().ShouldEqual(QualityCategory.Point);
        }

        [TestMethod]
        public void Yahoo_PlaceFinder_ResultsQualityDescription_ShouldMatchIntEquivalent()
        {
            var model = new Results
            {
                Quality = 59,
            };

            model.QualityDescription().ShouldEqual(QualityDescription.PostalDistrictIgnoreStreet);
        }

        [TestMethod]
        public void Yahoo_PlaceFinder_ResultQualityCategory_ShouldBeArea_WhenQualityIsLessThan70()
        {
            var model = new Result
            {
                Quality = 69,
            };

            model.QualityCategory().ShouldEqual(QualityCategory.Area);
        }

        [TestMethod]
        public void Yahoo_PlaceFinder_ResultQualityCategory_ShouldBeLine_WhenQualityIsGreaterThan69AndLessThan80()
        {
            var model = new Result
            {
                Quality = 79,
            };

            model.QualityCategory().ShouldEqual(QualityCategory.Line);
        }

        [TestMethod]
        public void Yahoo_PlaceFinder_ResultQualityCategory_ShouldBePoint_WhenQualityIsGreaterThan79()
        {
            var model = new Result
            {
                Quality = 80,
            };

            model.QualityCategory().ShouldEqual(QualityCategory.Point);
        }

        [TestMethod]
        public void Yahoo_PlaceFinder_ResultQualityDescription_ShouldMatchIntEquivalent()
        {
            var model = new Result
            {
                Quality = 49,
            };

            model.QualityDescription().ShouldEqual(QualityDescription.NeighborhoodLevel4IgnoreStreet);
        }

    }
}
